package game.Actors;

import game.Config.Storage;

import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Vector2f;
/**
 * This class represents money in the game.
 * The money on the screen always searches for the player, 
 * checking if their positions overlap.
 * This class extends actor, and thus has a positon and an image.
 * @author Sebastian Isheden and Victor Beer.
 *
 */
public class Money extends Actor{
	private float amount;
	/**
	 * Creates money based on the given parameters.
	 * @param image	The we want the money to have.
	 * @param position The position of the money.
	 * @param gold The amount of money.
	 */
	public Money(Image image, Vector2f position,float gold) {
		super(image, position);
		this.amount = gold;
	}
	@Override
	protected void update(int delta) {
		if(this.getCollisionRectangle(1).intersects(Storage.getPlayer().getCollisionRectangle(1f))){
			Storage.getPlayer().receiveMoney(this.amount);
			this.isDead = true;
		}
		
	}

}
